import 'reflect-metadata/Reflect.js';
import { Type } from 'class-transformer';
import Base from './Base';
import Caption from './Caption';
import { Compliment } from 'src/models/ComplimentConfig';
export default class Audio extends Base {
  public videoId = '';
  public title = '';
  public description = '';
  public url = '';
  public mimeType: AudioMimeType = AudioMimeType.MP3;
  public playCount = 0;
  public starCount = 0;
  public creatorName = '';
  public creatorId = '';
  public creatorAvatar?: string;
  public coverImage?: string;
  public status: AudioStatus = AudioStatus.UNKNOWN;
  public tagId = 0;
  public tag: AudioTag | null = null;
  public langCode = 'en-US';
  public language: AudioLanguage | null = null;
  public languageId = '';
  public subtitleUrl = '';
  public hasSubtitle = false;
  public isPlaying = false;
  public isPinned = false;
  public isOriginal = false;
  public hasCaption = false;
  public captionId = '';
  public compliments?: Compliment[];
  @Type(() => Caption)
  public caption?: Caption;
  constructor(id: string, title = 'Title', creator = 'Creator') {
    super();
    this.id = id;
    this.title = title;
    this.creatorName = creator;
    this.tagId = 0;
    this.tag = AudioTags[this.tagId];
    this.languageId = '0';
    this.language = new AudioLanguage('0', 'English');
  }
}
export enum AudioStatus {
  UNKNOWN = 0,
  NORMAL = 1,
  UPLOADING = 2,
  VERIFING = 3,
  DISALBED = 4,
  PRIVATE = 5,
  DRAFT = 6,
  UNPUBLISHED = 7,
}
export enum AudioMimeType {
  MP3 = 'audio/mpeg',
  WAV = 'audio/wav',
  OGA = 'audio/ogg',
  ACC = 'audio/acc',
  WEBA = 'audio/webm',
}
export class AudioTag {
  public id = '';
  public label = 'TRANSLATION';
  public color = '#4595EF';
  constructor(id: string, label = 'TRANSLATION', color = '#4595EF') {
    this.id = id;
    this.label = label;
    this.color = color;
  }
}
export class AudioLanguage {
  public id = '';
  public label = 'English';
  public normalColor = '';
  public hoverColor = '';
  public language = '';
  public code = '';
  public audioUrl = '';
  constructor(id: string, label: string, color = '#B7B7B7') {
    this.id = id;
    this.label = label;
    this.normalColor = color;
  }
}
export class AudioInteraction {
  public id = '';
  public count = 0;
  constructor(id: string, count = 0) {
    this.id = id;
    this.count = count;
  }
}
export const AudioTags: AudioTag[] = [
  new AudioTag('0', 'ORIGINAL', '#00B5BC'),
  new AudioTag('1', 'TRANSLATION', '#4595EF'),
  new AudioTag('2', 'VOICE OVER', '#E5CE00'),
];
